//
//  GAKKIFeatureCollectionView.h
//  GANGAIKit
//
//  Created by fh on 2019/11/8.
//  Copyright © 2019 cashchina. All rights reserved.
//

#import "GAKKIBaseView.h"
#import "GAKKIFeatureCollectionViewConfiguration.h"
#import "GAKKIConfig.h"

NS_ASSUME_NONNULL_BEGIN

/// 协议:封装UICollectionViewDelegate,目前只是提供点击方法,后续可以把UICollectionViewDelegate的方法都开放出来
@protocol GAKKIFeatureCollectionViewDelegate <NSObject>
@optional;
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath;
@end

/// 一种自定义适配布局的集合视图控件
@interface GAKKIFeatureCollectionView : GAKKIBaseView <UICollectionViewDelegateFlowLayout>

/// 集合视图控件
@property (nonatomic, readonly, strong) UICollectionView *collectionView;
/// 布局配置
@property (nonatomic, readonly, strong) GAKKIFeatureCollectionViewConfiguration *configuration;
/// 代理
@property (nonatomic, weak) id<GAKKIFeatureCollectionViewDelegate> delegate;

/// 初始化
- (instancetype)init;

/// 初始化0_1
/// @param delegate 代理
- (instancetype)initWithGAKKIFeatureCollectionViewDelegate:(id<GAKKIFeatureCollectionViewDelegate>)delegate;

/// 初始化0_2
/// @param delegate 代理
/// @param settingBlock 配置回调
- (instancetype)initWithGAKKIFeatureCollectionViewDelegate:(id<GAKKIFeatureCollectionViewDelegate>)delegate customConfigurationSettingBlock:(void(^ __nullable)(GAKKIFeatureCollectionViewConfiguration * settingConfiguration))settingBlock;

/// 初始化0_3
/// @param delegate 代理
/// @param settingBlock 配置回调
/// @param collectionViewDelegate 集合视图代理:如果制定外部代理则该类的配置文件将失效,需要代理实现流布局的协议,该参数一般置为nil
- (instancetype)initWithGAKKIFeatureCollectionViewDelegate:(id<GAKKIFeatureCollectionViewDelegate>)delegate customConfigurationSettingBlock:(void(^ __nullable)(GAKKIFeatureCollectionViewConfiguration * settingConfiguration))settingBlock collectionViewDelegate:(id<UICollectionViewDelegate> __nullable)collectionViewDelegate;

/// 初始化1_1
/// @param configuration 配置模型,nil的话使用默认配置
- (instancetype)initWithConfiguration:(GAKKIFeatureCollectionViewConfiguration * __nullable)configuration;

/// 初始化1_2
/// @param configuration 配置模型,nil的话使用默认配置
/// @param delegate 集合视图代理:如果制定外部代理则该类的配置文件将失效,需要代理实现流布局的协议,该参数一般置为nil
- (instancetype)initWithConfiguration:(GAKKIFeatureCollectionViewConfiguration * __nullable)configuration collectionViewDelegate:(id<UICollectionViewDelegate> __nullable)delegate;

/// 初始化1_3
/// @param settingBlock 配置回调
/// @param delegate 集合视图代理:如果制定外部代理则该类的配置文件将失效,需要代理实现流布局的协议,该参数一般置为nil
- (instancetype)initWithCustomConfigurationSettingBlock:(void(^ __nullable)(GAKKIFeatureCollectionViewConfiguration * settingConfiguration))settingBlock collectionViewDelegate:(id<UICollectionViewDelegate> __nullable)delegate;



/// 注册cell:这个方法需要在
/// @param cellClass cell
/// @param identifier 重用符标示
- (void)registerClass:(Class)cellClass forCellWithReuseIdentifier:(NSString * __nullable)identifier;

@end

NS_ASSUME_NONNULL_END
